package com.fitz.registry;

import com.fitz.loadbalance.AbstractLoadBalance;

import java.util.List;

/**
 * @author gousl01
 * @date 2021/4/30 15:58
 * @desc
 */
public interface InstanceRegistry {

    /**
     * 服务注册
     * @param instance
     */
    void register(InstanceInfo instance);

    void deRegister(InstanceInfo instance);

    List<InstanceInfo> getAllInstances(String serviceName);

    void subscribe(String serviceName);

    void unSubscribe(String serviceName);

    InstanceInfo discover(InstanceRegistry instanceRegistry,Class<? extends AbstractLoadBalance> loadBalanceClass,String serviceName);

    InstanceInfo discover(Class<? extends AbstractLoadBalance> loadBalanceClass,List<InstanceInfo> instances);
}
